<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="swiper-bundle.min.css" />
    <style>
      .swiper {
        width: 600px;
        height: 300px;
      }
      img {
        object-fit: cover;
        width: 600px;
        height: 300px;
      }
      .swiper-slide {
        /* text-align: center;
        font-size: 18px;
        background: #fff;
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center; */
        position: relative;
      }

      .slide-title {
        position: absolute;
        width: 100%;
        bottom: 20px;
        /* left: 20px; */
        color: #fff;
        background: rgba(0, 0, 0, 0.5);
        padding: 10px 0;
        text-align: center;
        opacity: 0.5;
        /* border-radius: 5px; */
      }
    </style>
  </head>
  <body>
    <div class="swiper">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <img src="images/1.png" />
          <div class="slide-title">Title 1</div>
        </div>
        <div class="swiper-slide">
          <img src="images/2.png" />
          <div class="slide-title">Title 2</div>
        </div>
        <div class="swiper-slide">
          <img src="images/3.png" />
          <div class="slide-title">Title 3</div>
        </div>
        <div class="swiper-slide">
          <img src="images/4.png" />
          <div class="slide-title">Title 4</div>
        </div>
        <div class="swiper-slide">
          <img src="images/5.png" />
          <div class="slide-title">Title 5</div>
        </div>
        <div class="swiper-slide">
          <img src="images/6.png" />
          <div class="slide-title">Title 6</div>
        </div>
        <div class="swiper-slide">
          <img src="images/7.png" />
          <div class="slide-title">Title 7</div>
        </div>
        <!-- <img src="images/1.png" />
        <img src="images/2.png" />
        <img src="images/3.png" />
        <img src="images/4.png" />
        <img src="images/5.png" />
        <img src="images/6.png" />
        <img src="images/7.png" /> -->
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>

      <!-- 如果需要导航按钮 -->
      <div class="swiper-button-prev"></div>
      <div class="swiper-button-next"></div>

      <!-- 如果需要滚动条 -->
      <div class="swiper-scrollbar"></div>
    </div>
  </body>
  <script src="swiper-bundle.min.js"></script>
  <script>
    var mySwiper = new Swiper(".swiper", {
      direction: "horizontal", // 垂直切换选项
      loop: true, // 循环模式选项
      autoplay: true,
      // 如果需要分页器
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },

      // 如果需要前进后退按钮
      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
        outline: "none",
      },

      // 如果需要滚动条
      scrollbar: {
        el: ".swiper-scrollbar",
      },
    });
  </script>
</html>
